/*
 * HMC5983.hpp
 *
 *  Created on: Jun 6, 2016
 *      Author: Yang
 */

#ifndef HMC5983_HPP_
#define HMC5983_HPP_

#include "Maths/Maths.hpp"
#include "HAL/HAL.hpp"
#include "Console/Console.hpp"

class Compass_HMC5983
{
public:
    Vector3f mag;
    Compass_HMC5983()
    {
    }
    void Init(void);
    void Data_Refresh(void);
private:
    void WRITE(uint8_t Data, uint8_t RegAddress);
    void READ(uint8_t* Data, uint8_t RegAddress, uint8_t Len);
    Vector3f Read_Original_Data(void);
    void Calibrate(void);
    float calibrate_scale[3]={1,1,1};

};

extern Compass_HMC5983 HMC5983;

#endif /* HMC5983_HPP_ */
